package flc.ast.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.text.SimpleDateFormat;

import flc.ast.R;
import flc.ast.bean.MyCategoryBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.media.bean.AudioBean;
import stark.common.basic.utils.TimeUtil;

public class CategoryAdapter extends StkProviderMultiAdapter<MyCategoryBean> {

    public CategoryAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new CategoryProvider());
    }

    private class CategoryProvider extends BaseItemProvider<MyCategoryBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_category;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyCategoryBean bean) {
            baseViewHolder.setText(R.id.tvCategoryItemName, bean.getName());
            if (bean.isSelect()) {
                baseViewHolder.setBackgroundResource(R.id.llCategoryItem,R.drawable.shape_category);
                baseViewHolder.setTextColor(R.id.tvCategoryItemName, Color.parseColor("#FF000000"));
            } else {
                baseViewHolder.setBackgroundResource(R.id.llCategoryItem,R.drawable.shape_category_off);
                baseViewHolder.setTextColor(R.id.tvCategoryItemName, Color.parseColor("#FF949494"));
            }
        }
    }

}
